/**
 * @Author: yy
 * @Date: 2019/8/12
 * @Last Modified by:   yy
 * @Last Modified time: 2019-08-15 15:00:00
 */
import axios from '@/api/fetch';
import SERVER from './../../server'

// 试驾管理查询信息
export const searchDriveManagement = params => axios.get(`${SERVER.CYXDMS_CLUE}/customerManage/testDrive/testDriveList`, { params });
// 试驾管理新增保存
export const addDriveManagement = params => axios.post(`${SERVER.CYXDMS_CLUE}/testDrive/saveTestDrivePlan`, params);
// 试驾管理编辑保存
export const editDriveManagement = ( id , params) => axios.put(`${SERVER.CYXDMS_CLUE}/customerManage/testDrive/modifyTestDrive/${id}`, params );
// 试驾管理详情
export const detailDriveManagement = ( itemId ) => axios.get(`${SERVER.CYXDMS_CLUE}/testDrive/testDrivePlanDetail?itemId=${itemId}`);
// 根据潜客ID查询
export const queryPotentialById = id => axios.get(`${SERVER.CYXDMS_CLUE}/potenCus/selectPotenInfoById/${id}` );
// 获取取消试驾原因
export const cancelReason = params => axios.get(`${SERVER.CYXDMS_CLUE}/testDrive/testDriveCancel`, {params});
// 取消或结束试驾
export const driveCancel = params => axios.post(`${SERVER.CYXDMS_CLUE}/testDrive/cancelOrFinishTestDrive`, params);
// 获取销售顾问信息
// export const getEmployeeInfo = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/employee/getEmployees`, {params});
export const getEmployeeInfo = params => axios.get(`${SERVER.CYXDMS_CLUE}/clue/employeeList`, { params });
// 获取试驾车型信息
export const getDriveCarInfo = params => axios.get(`${SERVER.CYXDMS_CLUE}/testDrive/testDriveCarInfo`, {params});
// 获取试驾路线信息
export const getDriveWayInfo = params => axios.get(`${SERVER.CYXDMS_CLUE}/customerManage/testDrive/testDriveWayList`, {params});
// 获取顾问列表
export const getEmpInfo = params => axios.get(`${SERVER.CYXDMS_CLUE}/potenCus/potentialCustomerNameAndPhone`, {params});

// 简化版试驾情况登记
export const addDriveManagementBq = params => axios.post(`${SERVER.CYXDMS_CLUE}/testDrive/testDriveRegistration`, params);
// 预约试驾
export const appointmentTestDrive = params => axios.get(`${SERVER.CYXDMS_CLUE}/customerManage/testDrive/appointmentTestDrive`, {params});
// 身份证识别
export const idCardIdentify = url => axios.get(`${SERVER.CTI}/ocr/cardLicense?url=${url}`, {url: url});
// 驾驶证识别（正本）
export const driveCardIdentify = url => axios.get(`${SERVER.CTI}/ocr/driverLicenseFront?url=${url}`, {url: url});

// 获得当前车厂是否有微信登录和短信发送
export const isHaveOCR = (appId) => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/login/getSmsWx?appId=${appId}` );

//试驾管理导出
export const getDriveManagementExcelList = params => {
  params = Object.assign(params, { menuId: '-1' });
  return axios({
    url: `${SERVER.CYXDMS_CLUE}/customerManage/testDrive/export/excel`,
    method: 'get',
    params: params,
    responseType: 'blob'
  });
};
